# Replication package for "Financial Sanction Spillovers and Firm Interdependence"
## Lorenzo Crippa, Nikhil Kalyanpur, and Abraham L. Newman
### _The Journal of Politics_, 2025

This file contains instructions on how to execute the code contained in the replication package and replicate the results contained in the main text and Online Appendix of the paper. For any query, please do not hesitate to reach out to the software curator, Lorenzo Crippa ([crippa.lnz@gmail.com](mailto:crippa.lnz@gmail.com)).

# Software specifications

The replication package folder contains an Rproject file called `LKN_JOP_2025_replication.Rproj`. Users can run all codes by simply opening this project in RStudio. That way, they do not have to set working directories manually.

The replication package runs entirely in R. All scripts have been executed on R version 4.4.2 (2024-10-31), on a MacBook Air M3 2024 (Platform aarch64-apple-darwin20), running under macOS Tahoe 26.0.1.

Several R packages are necessary in order to fully execute the code and generate all outputs. Full details on the packages necessary, as well as their versions, are reported in the file `sessionInfo.txt` which sits in the main directory. **WARNING**: in order to ensure the code runs smoothly, the user should ensure packages run on the versions specified in `sessionInfo.txt`.

# Appendix and codebook

The replication package folder contains two PDFs: `LKN_JOP_2025_appendix.pdf` (which reports the full Online Appendix) and `LKN_JOP_2025_codebook.pdf` (which reports the codebook and details all variables contained in the data files).

# Folder description

The replication package folder contains the following subfolders:

- `aux`: contains auxiliary code that serve the estimation or event windows. These scripts are sourced by the scripts in `code` and should not be executed on their own

	- `aux/estimation_function.R` wraps the `estimation_window` function that is used by the script `code/01_estimation_window.R`.

	- `aux/plot_theme.R` wraps the code that sets a default theme for all plots.

- `code`: contains all scripts necessary to run the analysis. Scripts should be run in the order in which they are numbered. Users can run each individual script numbered 01--10 or simply execute the script `code/00_execute_all.R`, which runs all other scripts sequentially and saves all outputs (plots, tables, and session logs in separate folders). Script number 01 performs the estimation window and should be run first. Script number 02 reproduces results in the main text. Scripts numbered 03--10 replicate one appendix section each. They are named with their corresponding appendix section name. 

	- `code/00_execute_all.R` is a script that executes all other scripts in the order and generate all plots, tables, and log files.

	- `code/01_estimation_window.R` sources stock market data and runs the estimation window phase.

	- `code/02_main.R` replicates all results reported in the main text.

	- `code/03_appendix_A.R`, `code/04_appendix_B.R`, ... `code/10_appendix_H.R` replicate all results reported in each of the appendices. Each script is named with the corresponding appendix section and numbered sequentially.
	
- `data_in`: contains the starting data files for the included scripts.
	
	- `data_in/data_estimation.rds` contains the main dataset with firm-day stock prices data and covariates. This file serves the estimation window script (`code/01_estimation_window.R`)
	
	- `data/media_coverage.xlsx` contains data on media coverage of sanctions in association with Tencent/WeChat or ByteDance/TikTok downloaded from Factiva. This file serves the script `code/04_appendix_B.R`
	
- `data_out`: contains all data files that are outputs of the scripts. 

	- `data_out/placeholder.txt` is an empty file that allows the folder to be generated when downloading the replication package.

- `logs`: contains all log files that are outputs of the script `code/00_execute_all.R`. 

	- `logs/placeholder.txt` is an empty file that allows the folder to be generated when downloading the replication package.

- `plots`: stores the plots generated by `code/02_main.R` and appendix scripts.
	
	- `plots/placeholder.txt` is an empty file that allows the folder to be generated when downloading the replication package.

- `tables`: stores the tables generated by appendix scripts.
	
	- `tables/placeholder.txt` is an empty file that allows the folder to be generated when downloading the replication package.

